<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="../../include/taglib.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<%@include file="../../include/inhead.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
<meta name="keywords" content="E爱车 洗车 到店洗车" />
<meta name="description" content="E爱车" />
<link rel="shortcut icon" href="${ctx}/static/imges/favicon.ico" />
<title>到店洗车</title>
<link rel="stylesheet" type="text/css" href="${ctx}/static/css/autoinn/bootstrap/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/static/css/autoinn/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/static/css/autoinn/slideNav.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/static/css/autoinn/washCar.css" />
<script type="text/javascript" src="http://api.map.baidu.com/api?ak=zV5nfPiCQxp1pBfTRyB3j4qO&v=2.08"></script>

</head>
	<style type="text/css">
		body {
			background-color: #f0efed;
		}
		.container {
			padding-left: 0px;
			padding-right: 0px;
		}
		.row {
			margin-left: 0px;
			margin-right: 0px;
		}
		.list-group-item:first-child {
			border-top-left-radius: 0px;
			border-top-right-radius: 0px;
		}
		.list-group-item:last-child {
			border-bottom-right-radius: 0px;
			border-bottom-left-radius: 0px;
		}
		.active a {
			color: #EF8A55;
		}
		a:hover {
			color: #919191;
			text-decoration: none;
		}
		.list-group-item:first-child {
			border-top-left-radius: 4px;
			border-top-right-radius: 4px;
		}
		.list-group-item:last-child {
			border-bottom-right-radius: 4px;
			border-bottom-left-radius: 4px;
		}
	</style>
	<script type="text/javascript" src="${ctx}/static/js/autoinn/jquery/jquery-1.7.min.js"></script>
	<script type="text/javascript" src="${ctx}/static/js/autoinn/bootstrap/bootstrap.min.js"></script>
	
	</head>

	<body>
		<div class="container">

			<div class="orange-orange-a row pf text-center border-1 bdc-e6e6e6 bgc-f8f8f8 pt-5 pb-5 z99 w h45 " style="left: 0; top: 0;">
				<div class="col-xs-4 line-height-35 text-left pl-15 pr-0 pt-0">
				</div>
				<div class="col-xs-4 line-height-35 f18 pr-0 pl-0 text-center">收藏门店</div>
				<div class="col-xs-4 line-height-35 text-right">
				 	<a id="ca" href="${ctx}/weixin/f/autoinn/user/gouserInfo" class=" pt-10 pb-10 pl-20 pr-0 ">
						<i class="fa fa-user pt-5 f20 pr-3"></i>用户中心
					</a> 
				</div>
			</div>

			<div class="row pt-100 pb-50 car-wash-list">


				<div class="pop-shade nav-hide"></div>
				<div class="col-xs-12 pb-15 nav-hide">
					<button class="btn btn-lg btn-default btn-block co3 get-more" data-page_index="1">查看更多...</button>
				</div>

			</div>

			<ul class="gray-orange-a list-inline row mr-0 ml-0 mb-0 h30 w pf bgc-f8f8f8 border-1 bdc-e6e6e6" style="bottom: 0; left: 0;">
				<li class="pt-10 pb-10 pr col-xs-12 pl-0  f12">
					<i class="pa fa fa-map-marker pt-3 pl-5 co1"></i>
					<div class="pl-25 pr-15" id="m_location"></div>
				</li>
			</ul>
		</div>
		<input type="hidden" id="shou" value="${shou }"/>
		<script type="text/javascript">
            var PARENT_URL ='',
            	ERROR_MSG = '',
                SUCCESS_MSG = '',
                INFO_MSG = '',
                WARNING_MSG = '';
        </script>

	    <script type="text/javascript" src="${ctx}/static/js/autoinn/jquery/jquery.placeholder.js"></script>
		<script type="text/javascript" src="${ctx}/static/js/autoinn/common.js"></script>
		<script type="text/javascript" src="${ctx}/static/js/autoinn/washCar.js"></script>
		<script type="text/javascript" charset="utf-8" src="${ctx}/static/js/autoinn/slideNav.js"></script>
		<script type="text/javascript">
		//隐藏微信分享按钮
		document.addEventListener("WeixinJSBridgeReady",
				function onBridgeReady(){
					WeixinJSBridge.call("hideOptionMenu")
				}
		);
		
		function notca(id){
			$.post(ctx+"/weixin/f/autoinn/xc/collect/del",{
				"delid":id
			    },
			     function(data){
			    
			   alert(data.message);
			   if(data.total=="0"){
				window.location.href=ctx+"/weixin/f/autoinn/xc/store";
			   }else{
				   window.location.href=ctx+"/weixin/f/autoinn/xc/collect";
			   }
			},"json");
			
		}
		
		
		function zhuan(id){
			 
			$.post(ctx+"/weixin/f/autoinn/xc/store/deltail/",{
				"id":id,
				"lng":$("#lng").val()/*
				"lat":lat*/},
			     function(data){
			
				window.location.href=ctx+data.url;
			},"json");
			
		}
		
		
			$(document).ready(function() {
				//获取参数
				var area_f=$.Global.Utils.getQueryString("area_f");
				var area_sub=$.Global.Utils.getQueryString("area_sub");
				var sort=$.Global.Utils.getQueryString("sort");
				var lng=null;
				var lat=null;
				//获取当前定位
				getLocationByGps();
				
				// 查看更多
			    $('.get-more').bind('click', function(){
			    	getData();
			    });
				
				function getData(){
					 var me =  $('.get-more'),
			            pageIndex = parseInt(me.data('page_index')),
			            strHtml = [
			                   	'<ul class="list-group col-xs-12  pl-15 pr-15">',
									'<li class="list-group-item row pl-0 pr-0 pr">',
									'<a href="javascript:zhuan(&quot;{0}&quot;);" class="mb-10">',
											'<div class="col-xs-12  pr-100  mb-10">',
												'<div class="fb f15 co7">{1}</div>',
												'<div class="f13 pt-10"><span class="pr-20 co3">{2}</span><span class="co2">免预约</span>',
												'</div>',
											'</div>',
											'<div class="pa pr-5 pl-0 text-right" style="right: 0;">',
												'<div>',
													'<i class="fa fa-rmb f13 co2"></i><span class="co2 f18 fb">{3}</span>',
													'<i class="fa  f14 co2">元起</i>',
												'</div>',
												'<div class="pt-5">',
													'<i class="f14 co1"></i><span class="f14 co1">距离</span><span class="f14 co1">{4}km</span>',
												'</div>',
											'</div>',
										'</a>',
										'<div class="bgc-ffffff mt-0 row">',
											'<div class="pt-10 pb-5 pr col-xs-6 pl-0 f16 text-center border-top border-right bdc-e6e6e6">',
												'<i class="pa fa fa-clock-o pt-3 pl-3 co1"></i>',
												'<span class="pl-25">09:00-18:00</span>',
											'</div>',
											'<div class="pt-10 pb-5 pr col-xs-6 pl-0 f16 text-center border-top bdc-e6e6e6">',
												'<i class="pa fa fa-phone pt-3 pl-3 co1"></i>',
												'<span class="pl-25"><a href="tel:{5}" class="co1">{5}</a></span>',
											'</div>',
											'<a class="co8" href="">',
												'<div class="pt-10 pr col-xs-12 pl-0 border-top bdc-e6e6e6 f14">',
													'<i class="pa fa fa-map-marker pt-3 pl-10 co1"></i>',
													'<div class="pl-25 pr-15 co1">{6}</div>',
												'</div>',
											'</a>',
											'<div class="pt-10 pr col-xs-12 pl-0 border-top bdc-e6e6e6 f14" onclick="notca(&quot;{0}&quot;);">',
											'<div class="pl-25 pr-15 co1">取消收藏</div></div>',
										'</div>',
									'</li>',
								'</ul>'
			            ].join('');
			       		g_ajax_processing_obj_id = $('.get-more').setUUID().attr('id');
			       		ajaxSend(ctx+"/weixin/f/autoinn/xc/collect/pagelist",
						         {"pageNum": pageIndex + 1,
					    		  "area_f" : area_f,
					    		  "area_sub" : area_sub,
					    		  "sort" : sort,
					    		  "lng"  : lng,
					    		  "lat"  : lat
					    		  }, 
						          function(data){
					    			    if(data.success){
					    			    	 if(data.rows!=null && data.rows.length > 0){
								                    var str = "";
								                     $.map(data.rows, function(d){
								                        str += String.format(
								                            strHtml,
								                            d.id,
								                            d.name, 
								                            d.areaname, 
								                            d.xprice,
								                            d.juli,
								                            d.tel,
								                            d.address
								                        );
								                    }); 
								                    $(str).insertBefore(me.parent());
								                    me.data("page_index", pageIndex + 1);
								              }else{
								            	  str= '<div class="blank10"></div><div class="alert alert-info mr-5 ml-5">未获取到相关数据</div>';
							    			    	$(str).insertBefore(me.parent());
								              }
					    			    }else {
						                   // me.parent().remove();
					    			    	str= '<div class="blank10"></div><div class="alert alert-info mr-5 ml-5">获取数据出现错误</div>';
					    			    	$(str).insertBefore(me.parent());
						                }
						            }
						   ); 
				}
				
				
			   
				//点击重新定位
				$("#btnresh").click(function() {
					getLocationByGps();
				});

			    
				//定位的方法
				function getLocationByGps() {
					//页面加载时初始化用户的坐标，如果没有坐标用浏览器定位
					var geolocation = new BMap.Geolocation();
					$("#m_location").html("<i></i>正在定位中...");
					geolocation.getCurrentPosition(function(r) {
						if (this.getStatus() == BMAP_STATUS_SUCCESS) {
							var myGeo = new BMap.Geocoder();
							myGeo.getLocation(r.point, function(result) {
								if (result) {
									var addComp = result.addressComponents;
									var latlngcity = addComp.city;
									lng=r.point.lng;
									lat=r.point.lat;
									getData();
									address=addComp.city  + addComp.district + addComp.street + addComp.streetNumber
									$("#m_location").html(result.address);
								} else {
									$("#m_location").html("未获取到位置");
								}
							});
						} else { 
							//从后台获取经纬度
							$("#m_location").html("<i></i>打开GPS可定位");
						}

					}, {
						enableHighAccuracy : true
					});
				}
				
			
				
			});
		</script>
		<script>
		var _hmt = _hmt || [];
		(function() {
		  var hm = document.createElement("script");
		  hm.src = "//hm.baidu.com/hm.js?3987c54e2c6d6c399fa4aca3fb9a7ef9";
		  var s = document.getElementsByTagName("script")[0]; 
		  s.parentNode.insertBefore(hm, s);
		})();
		</script>
		
	</body>
</html>